const http = uni.$u.http


// 登录注册api
const LoginApi = {
	testlogin: (data) => http.post('/auth/login', data, {
		custom: {
			loading: "登录中",
			isToken: false,
			isEncrypt: true
		},
	}),
	// wxlogin: (data) => http.post('user/wechatLogin', data, { custom: { loading: "登录中" } }),
};
// 用户相关api
const UserApi = {
	getUserinfo: () => http.post('user/userinfo'),
	host: (data) => http.post('index/host', data),
	// 获取字典

	getDictionary: (dick) => http.get(`/system/dict/data/type/${dick}`),

	// 获取角色
	getRoleApi: () => http.get('/system/role/list?pageNum=1&pageSize=100'),
	// 获取部分工序
	getAllTypeApi: () => http.get('/system/customizedType/getAllType'),
	// 获取公告
	getAnnouncementApi: () => http.get('/system/notice/getRecentNotice?noticeType=2'),
	// 新增公告
	newAnnouncementApi: (data) => http.post('/system/notice', data),
	// 查所有工序列表
	getAllWorkingProcedureListApi: () => http.get('/system/workingProcedureInfo/getAllProcedureList'),

	// 判断权限
	getCheckPermissions: (data) => http.post('/system/miniProgram/judgeAllPermission', data),
	// 判断验收入库的权限
	getInspectionAndWarehousing: (ids, type) => http.get('/system/miniProgram/judgeCheckInPermission?id=' + ids + '&type=' + type),
	// 获取全部部门
	getAllDepartmentApi: ()  => http.get('/system/dept/getAllDeptNoPage '),
	// 根据部门编号获取员工
	getDepartmentalStaffApi: (deptId)  => http.get('/system/user/getUserListByDept?deptId=' + deptId),
};

// 逻辑 Api
const logicApi = {
	// 获取成品组装详情
	getDetails: (ids) => http.get('/system/productAssembly/productionAssemblyDetail?id=' + ids),
	// 成品组装页面详情
	finishedProductAssemblyApi: (ids) => http.get(`/system/productAssembly/assemblyDetail?id=${ids}`),
	// 成品组装入库
	finishedProductAssemblyWarehousingApi: (data) => http.put('/system/productAssembly/productAssemblyInStorage',
		data),

	// 获取微定制详情
	getMicroCustomizationApi: (ids) => http.get('/system/microCustomizeProduce/microAssemblyDetail?id=' + ids),
	// 微定制组装入库详情
	getMicroCustomizeProduceWarehousingApi: (ids) => http.get('/system/microCustomizeProduce/assemblyInDetail?id=' +
		ids),
	// 微定制订单组装入库
	microCustomizeProduceWarehousingApi: (data) => http.put('/system/microCustomizeProduce/assemblyIn', data),

	// 获取包装件详情
	getPackagingInformationApi: (ids) => http.get('/system/packingProduce/getPackingOrderDetail?id=' + ids),
	// 包装件提交
	putPackageSubmissionApi: (data) => http.put('/system/packingProduce/packingAssemble', data),

	// 微定专版详情
	getMicroCustomizedEditionApi: (ids) => http.get('/system/productionIntegration/getProduceDetail?id=' + ids),
	// 获取当前生产详情
	getCurrentProductionApi: (ids, relationId) => http.get(
		`/system/productionIntegration/getCurrentProduce?id=${ids}&relationId=${relationId}`),
	//  微定专版入库
	putSpecialEditionStorage: (data) => http.put('/system/productionIntegration/inOver', data),
	// 微定专版 提交录入
	getProductionIntegrationWarehousingApi: (data) => http.put('/system/productionIntegration/workProduceIn', data),

	// 获取不锈钢详情
	getStainlessSteelApi: (ids) => http.get('/system/stainlessPlate/getCustomizedOrderDetail?id=' + ids),
	// 获取不锈钢工序详情
	getStainlessSteelProcessApi: (ids) => http.get('/system/stainlessPlate/getCustomizedAuxiliaryProduce?id=' +
		ids),
	// 不锈钢提交录入
	getSaveProductionIntegrationInApi: (data) => http.put('/system/stainlessPlate/workProduceIn', data),
	// 不锈钢入库完结
	getStainlessSteelFinished: (data) => http.put('/system/stainlessPlate/inOver', data),

	// 获取半成品详情
	getDetailsOfSemiFinishedProductsApi: (ids) => http.get('/system/semiProduce/getCurrentProduceDetail?id=' + ids),
	// 开始生产
	saveSemiProduceAcceptApi: (data) => http.put(
		`/system/semiProduce/saveNumber?number=${data.number}&id=${data.id}&supplyId=${data.supplyId}`),
	// 工序录入
	startInputtingSemiFinishedProductApi: (data) => http.put(
		`/system/semiProduce/enterWorkProcedure?number=${data.number}&id=${data.id}&price=${data.price}&overFlag=${data.overFlag}&extraFees=${data.extraFees}`
	),
	// 配件入库详情
	detailsOfAccessoryStorage: (ids) => http.get('/system/semiProduce/componentStorageDetail?id=' + ids),
	// 配件入库
	saveSemiProduceInApi: (data) => http.put('/system/semiProduce/componentStorage', data),

	// 获取全部员工
	getAllEmployeesApi: () => http.get('/system/user/getAllStaff'),
	// 获取配件  获取BOM关联半成品 辅材
	getBomRelatedSemiFinishedApi: (ids) => http.get(`/system/bomInfo/getBomRelat?id=${ids}`),
	// 获取微定制的配件
	getMicroCustomizeRelatedProductApi: (ids) => http.get(
		`/system/microCustomizeProduce/getMicroRelatProduct?id=${ids}`),
	// 获取包装件配件
	getPackingRelatedProductApi: (ids) => http.get(`/system/packingProduce/getPackingRelatProduct?relation=${ids}`),

	//获取供应商列表 不分页
	getSuppliersApi: (ids) => http.get(`/system/supplyFactories/getSupplierList?supplyType=${ids}`),
	///** 根据roleKey查询用户 */
	getUserListByRole: (ids) => http.get(`/system/user/getUserListByRoleKey?roleKey=${ids}`),

	// 查询库存
	getInventoryListApi: (data) => http.post('/system/miniProgram/queryInventory', data),
	// 查询我的订单
	getMyOrderApi: (data) => http.post('/system/orderStaffWages/myWages', data),
	// 新增订单角色权限
	// addOrderRolePermissions:  (data) => http.post(`/system/roleOrderPermission?roleKeys=${JSON.parse(JSON.stringify(data.roleKeys))}&processNumber=${data.processNumber}&orderOperation=${data.orderOperation}`),
	addOrderRolePermissions:  (data) => http.post(`/system/roleOrderPermission`, data),
	// 获取权限列表
	getPermissionList: () => http.post('/system/roleOrderPermission/list'),
	// 删除订单角色权限
	deletePermissionList: (data) => http.delete('/system/roleOrderPermission/remove?id=' + data.id ),
	// 验收入库详情
	getAcceptanceAndStorageDetails: (ids) => http.get(`/system/miniProgram/checkInDetail?data=${ids}`),
	// 1 验收入库
	checkInStorageApi: (data) => http.post(data),
	// 2 验收入库
	microCustomizationAcceptanceAndStorageApi: (data) => http.put(data),
	
}

export default {
	...LoginApi,
	...UserApi,
	...logicApi
}